package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Demand {
    private int demandId;//需求id
    private String demandTitle;//需求主题
    private String demandPeople;//需求提供人
    private String demandImport;//重要程度
    private String demandContext;//需求内容
    private Customer customerByCustomId;//客户
    private BusinessInfo businessInfoByBusinesId;//商机
    private Integer demandStatus;//状态
    private Timestamp demandTime;//记录时间
    private Emp  demandEmp;//记录人


    @ManyToOne
    @JoinColumn(name="demand_emp" ,referencedColumnName = "employees_id")
    public Emp getDemandEmp() {
        return demandEmp;
    }

    public void setDemandEmp(Emp demandEmp) {
        this.demandEmp = demandEmp;
    }

    @Id
    @Column(name = "demand_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getDemandId() {
        return demandId;
    }

    public void setDemandId(int demandId) {
        this.demandId = demandId;
    }

    @Basic
    @Column(name = "demand_title")
    public String getDemandTitle() {
        return demandTitle;
    }

    public void setDemandTitle(String demandTitle) {
        this.demandTitle = demandTitle;
    }

    @Basic
    @Column(name = "demand_people")
    public String getDemandPeople() {
        return demandPeople;
    }

    public void setDemandPeople(String demandPeople) {
        this.demandPeople = demandPeople;
    }

    @Basic
    @Column(name = "demand_import")
    public String getDemandImport() {
        return demandImport;
    }

    public void setDemandImport(String demandImport) {
        this.demandImport = demandImport;
    }

    @Basic
    @Column(name = "demand_context")
    public String getDemandContext() {
        return demandContext;
    }

    public void setDemandContext(String demandContext) {
        this.demandContext = demandContext;
    }
    @Basic
    @Column(name = "demand_status")
    public Integer getDemandStatus() {
        return demandStatus;
    }

    public void setDemandStatus(Integer demandStatus) {
        this.demandStatus = demandStatus;
    }

    @Basic
    @Column(name = "demand_time")
    public Timestamp getDemandTime() {
        return demandTime;
    }

    public void setDemandTime(Timestamp demandTime) {
        this.demandTime = demandTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Demand demand = (Demand) o;
        return demandId == demand.demandId &&
                Objects.equals(demandTitle, demand.demandTitle) &&
                Objects.equals(demandPeople, demand.demandPeople) &&
                Objects.equals(demandImport, demand.demandImport) &&
                Objects.equals(demandContext, demand.demandContext);
    }

    @Override
    public int hashCode() {
        return Objects.hash(demandId, demandTitle, demandPeople, demandImport, demandContext);
    }

    @ManyToOne
    @JoinColumn(name = "custom_id",referencedColumnName = "custom_id")
    public Customer getCustomerByCustomId() {
        return customerByCustomId;
    }

    public void setCustomerByCustomId(Customer customerByCustomId) {
        this.customerByCustomId = customerByCustomId;
    }

    @ManyToOne
    @JoinColumn(name = "busines_id", referencedColumnName = "busines_id")
    public BusinessInfo getBusinessInfoByBusinesId() {
        return businessInfoByBusinesId;
    }

    public void setBusinessInfoByBusinesId(BusinessInfo businessInfoByBusinesId) {
        this.businessInfoByBusinesId = businessInfoByBusinesId;
    }
}
